Optimal. Leaf size=96 \[ a^2 A x+\frac {a^2 (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a^2 (A+C) \tan (c+d x)}{d}+\frac {C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 96, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {4140, 4002,
3999, 3852, 8, 3855} \begin {gather*} \frac {a^2 (A+C) \tan (c+d x)}{d}+\frac {a^2 (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+a^2 A x+\frac {C \tan (c+d x) \left (a^2 \sec (c+d x)+a^2\right )}{3 d}+\frac {C \tan (c+d x) (a \sec (c+d x)+a)^2}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 3999
Rule 4002
Rule 4140
Rubi steps
\begin {align*} \int (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \, dx &=\frac {C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {\int (a+a \sec (c+d x))^2 (3 a A+2 a C \sec (c+d x)) \, dx}{3 a}\\ &=\frac {C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{3 d}+\frac {\int (a+a \sec (c+d x)) \left (6 a^2 A+6 a^2 (A+C) \sec (c+d x)\right ) \, dx}{6 a}\\ &=a^2 A x+\frac {C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{3 d}+\left (a^2 (A+C)\right ) \int \sec ^2(c+d x) \, dx+\left (a^2 (2 A+C)\right ) \int \sec (c+d x) \, dx\\ &=a^2 A x+\frac {a^2 (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{3 d}-\frac {\left (a^2 (A+C)\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}\\ &=a^2 A x+\frac {a^2 (2 A+C) \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a^2 (A+C) \tan (c+d x)}{d}+\frac {C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {C \left (a^2+a^2 \sec (c+d x)\right ) \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(1090\) vs. \(2(96)=192\).
time = 6.57, size = 1090, normalized size = 11.35 \begin {gather*} \frac {A x \cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right )}{2 (A+2 C+A \cos (2 c+2 d x))}+\frac {(-2 A-C) \cos ^4(c+d x) \log \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right ) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right )}{2 d (A+2 C+A \cos (2 c+2 d x))}+\frac {(2 A+C) \cos ^4(c+d x) \log \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right ) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right )}{2 d (A+2 C+A \cos (2 c+2 d x))}+\frac {C \cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \sin \left (\frac {d x}{2}\right )}{12 d (A+2 C+A \cos (2 c+2 d x)) \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )^3}+\frac {\cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \left (7 C \cos \left (\frac {c}{2}\right )-5 C \sin \left (\frac {c}{2}\right )\right )}{24 d (A+2 C+A \cos (2 c+2 d x)) \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )^2}+\frac {\cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \left (3 A \sin \left (\frac {d x}{2}\right )+5 C \sin \left (\frac {d x}{2}\right )\right )}{6 d (A+2 C+A \cos (2 c+2 d x)) \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}+\frac {C \cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \sin \left (\frac {d x}{2}\right )}{12 d (A+2 C+A \cos (2 c+2 d x)) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )^3}+\frac {\cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \left (-7 C \cos \left (\frac {c}{2}\right )-5 C \sin \left (\frac {c}{2}\right )\right )}{24 d (A+2 C+A \cos (2 c+2 d x)) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )^2}+\frac {\cos ^4(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \left (A+C \sec ^2(c+d x)\right ) \left (3 A \sin \left (\frac {d x}{2}\right )+5 C \sin \left (\frac {d x}{2}\right )\right )}{6 d (A+2 C+A \cos (2 c+2 d x)) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.54, size = 119, normalized size = 1.24
method | result | size |
derivativedivides | \(\frac {a^{2} A \tan \left (d x +c \right )-a^{2} C \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 a^{2} A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a^{2} C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a^{2} A \left (d x +c \right )+a^{2} C \tan \left (d x +c \right )}{d}\) | \(119\) |
default | \(\frac {a^{2} A \tan \left (d x +c \right )-a^{2} C \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 a^{2} A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a^{2} C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a^{2} A \left (d x +c \right )+a^{2} C \tan \left (d x +c \right )}{d}\) | \(119\) |
risch | \(a^{2} A x -\frac {2 i a^{2} \left (3 C \,{\mathrm e}^{5 i \left (d x +c \right )}-3 A \,{\mathrm e}^{4 i \left (d x +c \right )}-3 C \,{\mathrm e}^{4 i \left (d x +c \right )}-6 A \,{\mathrm e}^{2 i \left (d x +c \right )}-12 C \,{\mathrm e}^{2 i \left (d x +c \right )}-3 C \,{\mathrm e}^{i \left (d x +c \right )}-3 A -5 C \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}+\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{d}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}\) | \(196\) |
norman | \(\frac {a^{2} A x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a^{2} A x +3 a^{2} A x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a^{2} A x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {2 a^{2} \left (A +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {4 a^{2} \left (3 A +4 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {2 \left (A +C \right ) a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}+\frac {a^{2} \left (2 A +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {a^{2} \left (2 A +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) | \(198\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 131, normalized size = 1.36 \begin {gather*} \frac {6 \, {\left (d x + c\right )} A a^{2} + 2 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C a^{2} - 3 \, C a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 6 \, A a^{2} \tan \left (d x + c\right ) + 6 \, C a^{2} \tan \left (d x + c\right )}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.19, size = 131, normalized size = 1.36 \begin {gather*} \frac {6 \, A a^{2} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, A + C\right )} a^{2} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, A + C\right )} a^{2} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left ({\left (3 \, A + 5 \, C\right )} a^{2} \cos \left (d x + c\right )^{2} + 3 \, C a^{2} \cos \left (d x + c\right ) + C a^{2}\right )} \sin \left (d x + c\right )}{6 \, d \cos \left (d x + c\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int A\, dx + \int 2 A \sec {\left (c + d x \right )}\, dx + \int A \sec ^{2}{\left (c + d x \right )}\, dx + \int C \sec ^{2}{\left (c + d x \right )}\, dx + \int 2 C \sec ^{3}{\left (c + d x \right )}\, dx + \int C \sec ^{4}{\left (c + d x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 187 vs.
\(2 (92) = 184\).
time = 0.50, size = 187, normalized size = 1.95 \begin {gather*} \frac {3 \, {\left (d x + c\right )} A a^{2} + 3 \, {\left (2 \, A a^{2} + C a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, A a^{2} + C a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (3 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 6 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 8 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.58, size = 184, normalized size = 1.92 \begin {gather*} \frac {2\,A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {4\,A\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,a^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {5\,C\,a^2\,\sin \left (c+d\,x\right )}{3\,d\,\cos \left (c+d\,x\right )}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{d\,{\cos \left (c+d\,x\right )}^2}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{3\,d\,{\cos \left (c+d\,x\right )}^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________